/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kit.learning.listner;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 *
 * @author thilinaj
 */

public class MyServletContextListener implements ServletContextListener{

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("Listning to event");
        ServletContext sc = sce.getServletContext();
        String dogName = sc.getInitParameter("tomy");
        Dog d = new Dog(dogName);
        sc.setAttribute("dog", d);
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
